/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NuevoAvion.java
 *
 * Created on Sep 15, 2011, 4:25:41 PM
 */
package proyecto1;

import java.util.HashSet;
import java.util.List;

/**
 *
 * @author odra
 */
public class NuevoAvion extends javax.swing.JFrame {
 Avion aviones = new Avion();
 Aerolinea a = new Aerolinea ();
    /** Creates new form NuevoAvion */
    public NuevoAvion() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        nombre = new javax.swing.JTextField();
        vuelos = new javax.swing.JComboBox();
        grabar = new javax.swing.JButton();
        nuevo = new javax.swing.JButton();
        primera = new javax.swing.JRadioButton();
        ejecutiva = new javax.swing.JRadioButton();
        turista = new javax.swing.JRadioButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(proyecto1.Proyecto1App.class).getContext().getResourceMap(NuevoAvion.class);
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        nombre.setText(resourceMap.getString("nombre.text")); // NOI18N
        nombre.setName("nombre"); // NOI18N

        vuelos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "NACIONAL", "INTERNACIONAL" }));
        vuelos.setName("vuelos"); // NOI18N

        grabar.setText(resourceMap.getString("grabar.text")); // NOI18N
        grabar.setName("grabar"); // NOI18N
        grabar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                grabarMouseClicked(evt);
            }
        });

        nuevo.setText(resourceMap.getString("nuevo.text")); // NOI18N
        nuevo.setName("nuevo"); // NOI18N
        nuevo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                nuevoMouseClicked(evt);
            }
        });

        primera.setText(resourceMap.getString("primera.text")); // NOI18N
        primera.setName("primera"); // NOI18N

        ejecutiva.setText(resourceMap.getString("ejecutiva.text")); // NOI18N
        ejecutiva.setName("ejecutiva"); // NOI18N

        turista.setText(resourceMap.getString("turista.text")); // NOI18N
        turista.setName("turista"); // NOI18N

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(126, 126, 126)
                        .add(jLabel1))
                    .add(layout.createSequentialGroup()
                        .add(51, 51, 51)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(layout.createSequentialGroup()
                                .add(jLabel2)
                                .add(85, 85, 85)
                                .add(nombre, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 229, Short.MAX_VALUE))
                            .add(layout.createSequentialGroup()
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel3)
                                    .add(jLabel4))
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(layout.createSequentialGroup()
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                        .add(vuelos, 0, 229, Short.MAX_VALUE))
                                    .add(layout.createSequentialGroup()
                                        .add(15, 15, 15)
                                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(primera)
                                            .add(ejecutiva)
                                            .add(turista))
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))))))
                .addContainerGap())
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(110, Short.MAX_VALUE)
                .add(nuevo)
                .add(42, 42, 42)
                .add(grabar)
                .add(97, 97, 97))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel2)
                    .add(nombre, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel3)
                    .add(vuelos, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel4)
                    .add(primera))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(ejecutiva)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(turista)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 18, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(grabar)
                    .add(nuevo))
                .add(59, 59, 59))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void grabarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_grabarMouseClicked
// TODO add your handling code here:
        String n = this.nombre.getText();
        aviones.setNombre(n);
        int v = this.vuelos.getSelectedIndex();
        String p = this.primera.getActionCommand();
        aviones.setcPrimera(p);
        String e = this.ejecutiva.getActionCommand();
        aviones.setcEjecutiva(e);
        String t = this.turista.getActionCommand();
        aviones.setcTurista(t);
        char x;
        if (v == 0)
        {x = 'N' ;}
        else
        {x = 'I';}     
        aviones.setvInternacional(x);
        Aerolinea.avion.add(new Avion(aviones.getNombre(),aviones.getvInternacional(),aviones.getcPrimera(),aviones.getcEjecutiva(),aviones.getcTurista()));
}//GEN-LAST:event_grabarMouseClicked

private void nuevoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_nuevoMouseClicked
        this.nombre.setText("");
        this.vuelos.setSelectedIndex(-1);
        this.primera.setSelected(false);
        this.ejecutiva.setSelected(false);
        this.turista.setSelected(false);
}//GEN-LAST:event_nuevoMouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(NuevoAvion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(NuevoAvion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(NuevoAvion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(NuevoAvion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new NuevoAvion().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JRadioButton ejecutiva;
    private javax.swing.JButton grabar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JTextField nombre;
    private javax.swing.JButton nuevo;
    private javax.swing.JRadioButton primera;
    private javax.swing.JRadioButton turista;
    private javax.swing.JComboBox vuelos;
    // End of variables declaration//GEN-END:variables
}
